| Total Complexity | 6 | 
| Total Lines | 22 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | import { CodeBoost } from '@/lib/CodeBoost'; | ||
| 2 | |||
| 3 | export class BatchManager { | ||
| 4 | public data: any[] = []; | ||
| 5 | |||
| 6 |     constructor(public filename: string, public codeboost: CodeBoost) { | ||
| 7 | this.data = filename ? require(filename) : []; | ||
| 8 | } | ||
| 9 | |||
| 10 |     protected getBoost(boostName: string) { | ||
| 11 | return this.codeboost.getBoost(boostName); | ||
| 12 | } | ||
| 13 | |||
| 14 |     public getBatch(boostName: string, size: number) { | ||
| 15 | return this.getUsableDataset(boostName).slice(0, size); | ||
| 16 | } | ||
| 17 | |||
| 18 |     public insertBatch(item: any) { | ||
| 19 |         this.data.push({ name: item }); | ||
| 20 | } | ||
| 21 | |||
| 22 |     public getUsableDataset(boostName: string) { | ||
| 23 | return this.data.filter(repo => this.getBoost(boostName)?.canRunOnRepository(repo.name)); | ||
| 24 | } | ||
| 26 |